function addRow(itemNum, keyName) {
	if($(".new-row").length == 0) {
		var s = "";
	    	s += '<div class="row new-row">';

	    var id = new Date().getTime();
	    
	    s += '<div class="item">' + id + '</div>';
	    for(var i = 0; i < itemNum - 2; i++) {
	    		s += '<div class="item">';
				s += '<input type="text" name="attr' + (i+1) + '" />';
				s += '</div>';
	    }
		s += '<div class="item">';
		s += '<div class="btn-box">';
		s += '<div class="btn cancel-btn">取消</div>';
		s += '<div class="btn save-btn">保存</div>';
		s += '<input type="hidden" class="id" value="' + parseInt(id - 1) + '">';
		s += '</div>';
		s += '</div>';
		s += '</div>';
		$(".list").find(".msg").remove();
		$(".list").append(s);
		$(".new-row").children(".item").eq(1).children("input").focus();
	}
	else {
		alert("不要急，一个一个来");
	}
}

Array.prototype.remove = function(dx) 
{ 
    if(isNaN(dx) || dx > this.length) { return false; } 
    for(var i = 0, n = 0;i < this.length; i++) 
    { 
        if(this[i] != this[dx]) 
        { 
            this[n++] = this[i];
        } 
    } 
    console.log(this);
    this.length-=1;
}

function isNum(obj) {
	var val = $(obj).val() + "";
	if(isNaN(val)) {
		alert("请输入数字，就是0123456789呀");
		$(obj).val(val.substr(0, val.length - 1));
		$(obj).focus();
	}
}

function isEleven(obj) {
	var val = $(obj).val() + "";
	if(val.length != 11) {
		alert("请输入11位");
		$(obj).focus();
	}
}

function isNull(obj) {
	if($(obj).val() == "" || $(obj).val() == null) {
		alert("不能为空喔");
		$(obj).val("0");
	}
}